added SSCLI 1.0
[windows-sources.git] / shared source / sscli20 / tools / nmake / globals.cpp
blobed88c1a24b8892f922a76a8595fed6c5a59d3ead
1 // ==++==
2 //
3 //
4 // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
5 //
6 // The use and distribution terms for this software are contained in the file
7 // named license.txt, which can be found in the root of this distribution.
8 // By using this software in any fashion, you are agreeing to be bound by the
9 // terms of this license.
10 //
11 // You must not remove this notice, or any other, from this software.
12 //
14 // ==--==
15 // globals.c - global variables/needed across modules
17 // Purpose:
18 // This is the routine in which global variables reside.
20 // Notes:
21 // This module was created for an interesting reason. NMAKE handles recursive
22 // calls by saving its global variables somewhere in memory. It handles this by
23 // allocating all global variables which have value changes in each recursive
24 // in adjacent memory. The routine called recursively is doMake() and before it
25 // is called the address of this chunk of memory is stored. When the recursive
26 // call returns the memory is restored using the stored address. startOfSave and
27 // endOfSave give the location of this chunk. The reason this method was opted
28 // for is that spawning of NMAKE would consume a lot of memory under DOS. This
29 // might not be very efficient under OS/2 because the code gets shared.
31 #include "precomp.h"
32 #ifdef _MSC_VER
33 #pragma hdrstop
34 #endif
36 #if defined(STATISTICS)
37 unsigned long CntfindMacro;
38 unsigned long CntmacroChains;
39 unsigned long CntinsertMacro;
40 unsigned long CntfindTarget;
41 unsigned long CnttargetChains;
42 unsigned long CntStriCmp;
43 unsigned long CntunQuotes;
44 unsigned long CntFreeStrList;
45 unsigned long CntAllocStrList;
46 #endif
48 BOOL fOptionK; // TRUE if user specifies /K
49 BOOL fDescRebuildOrder; // TRUE if user specifies /O
50 BOOL fSlashKStatus = TRUE; // no error when slash K specified
53 // Used by action.c & nmake.c
55 // Required to make NMAKE inherit user modified changes to the environment. To
56 // be set to true before defineMacro() is called so that user defined changes
57 // in environment variables are reflected in the environment. If set to false
58 // then these changes are made only in NMAKE tables and the environment remains
59 // unchanged
61 BOOL fInheritUserEnv;
63 BOOL fRebuildOnTie; // TRUE if /b specified, Rebuild on tie
65 // Used by action.c and nmake.c
67 // delList is the list of delete commands for deleting inline files which are
68 // not required anymore (have a NOKEEP action specified.
70 STRINGLIST * delList;
72 // Complete list of generated inline files. Required to avoid duplicate names
73 // NOTNEEDED
75 STRINGLIST * inlineFileList;
77 // from NMAKE.C
78 // No of blanks is same as no of Allowed options in NMAKE; currently 14
79 // L = nologo, H = help
80 // corr to ABCDEHIKLNPQRSTUY?
81 char makeflags[] = "MAKEFLAGS= ";
82 BOOL firstToken; // to initialize parser
83 BOOL bannerDisplayed;
84 UCHAR flags; // holds -d -s -n -i -u
85 UCHAR gFlags; // "global" -- all targets
86 FILE * file;
87 STRINGLIST * makeTargets; // list of targets to make
88 STRINGLIST * makeFiles; // user can specify > 1
89 BOOL fDebug;
90 MACRODEF * pMacros;
91 STRINGLIST * pValues;
93 // from LEXER.C
94 BOOL colZero = TRUE; // global flag set if at column zero of a makefile/tools.ini
95 unsigned line;
96 char * fName;
97 char * string;
98 INCLUDEINFO incStack[MAXINCLUDE]; //Assume this is initialized to null
99 int incTop;
101 // Inline file list -- Gets created in lexer.c and is used by action.c to
102 // produce a delete command when 'NOKEEP' or Z option is set
104 SCRIPTLIST * scriptFileList;
106 // from PARSER.C
107 BOOL init; // global boolean value to indicate if tools.ini is being parsed
108 UCHAR stack[STACKSIZE];
109 int top = -1; // gets pre-incremented before use
110 unsigned currentLine; // used for all error messages
112 // from ACTION.C
115 MACRODEF * macroTable[MAXMACRO];
116 MAKEOBJECT * targetTable[MAXTARGET];
117 STRINGLIST * macros;
118 STRINGLIST * dotSuffixList;
119 STRINGLIST * dotPreciousList;
120 RULELIST * rules;
121 STRINGLIST * list;
122 char * name;
123 BUILDBLOCK * block;
124 UCHAR currentFlags;
125 UCHAR actionFlags;
127 // from BUILD.C
130 unsigned errorLevel;
131 unsigned numCommands;
132 char * shellName;
133 char CmdLine[MAXCMDLINELENGTH];
135 // from IFEXPR.C
137 UCHAR ifStack[IFSTACKSIZE];
138 int ifTop = -1; // pre-incremented
139 char * lbufPtr; // ptr to alloced buf
140 char * prevDirPtr; // ptr to directive
141 unsigned lbufSize; // initial size
142 int chBuf = -1;
145 // from UTIL.C
147 char * dollarDollarAt;
148 char * dollarLessThan;
149 char * dollarStar;
150 char * dollarAt;
151 STRINGLIST * dollarQuestion;
152 STRINGLIST * dollarStarStar;
154 // from parser.c
156 char buf[MAXBUF];
158 // from action.c
160 const char suffixes[] = ".SUFFIXES";
161 const char ignore[] = ".IGNORE";
162 const char silent[] = ".SILENT";
163 const char precious[] = ".PRECIOUS";